package com.spzx.api.cart.api;

import com.spzx.api.cart.domain.CartInfo;
import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.common.core.web.domain.AjaxResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;

@FeignClient(contextId = "remoteCartService",
             value = ServiceNameConstants.CART_SERVICE,
             fallbackFactory = RemoteCartFallbackFactory.class )
public interface RemoteCartService {
    @GetMapping("getCartCheckedList")
    R<List<CartInfo>> getCartsWithChecked(@RequestHeader(SecurityConstants.FROM_SOURCE) String inner);
    //更新实时价格
    @GetMapping("updateCartPrice/{userId}")
    R<Boolean> updateCartPrice(@PathVariable("userId") Long userId,@RequestHeader(SecurityConstants.FROM_SOURCE) String inner);
    //删除购物车已经支付的商品
    @DeleteMapping("deleteCart/{skuId}")
    AjaxResult deleteCart(@PathVariable("skuId") Long skuId,@RequestHeader(SecurityConstants.FROM_SOURCE) String inner);
}